//
//  IntroduceCollectionViewCell.m
//  ZYZB
//
//  Created by ENERGY on 2018/6/28.
//  Copyright © 2018年 ENERGY. All rights reserved.
//

#import "FunctionCollocetionViewCell.h"
@interface FunctionCollocetionViewCell ()
@property (nonatomic, strong)UIImageView * iconImageView;//图标
@property (nonatomic, strong)UILabel * titleLab;//标题
@end
@implementation FunctionCollocetionViewCell

- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        self.contentView.backgroundColor = [UIColor whiteColor];
        __weak typeof (self)weakSelf = self;
        int iconImgW = 45/WIDTH_6_SCALE;
        [self.contentView addSubview:self.iconImageView];
        [self.contentView addSubview:self.titleLab];
        [self.iconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.right.top.equalTo(weakSelf.contentView);
            make.height.mas_equalTo(iconImgW);
        }];
        [self.titleLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(weakSelf.iconImageView.mas_bottom).mas_equalTo(10/WIDTH_6_SCALE);
            make.left.right.equalTo(weakSelf.contentView);
            make.height.mas_equalTo(15/WIDTH_6_SCALE);
        }];
        self.iconImageView.layer.masksToBounds = YES;
        self.iconImageView.layer.cornerRadius = iconImgW/2;
    }return self;
}
#pragma mark - init
- (UIImageView *)iconImageView{
    if (!_iconImageView) {
        _iconImageView = [[UIImageView alloc] init];
        _iconImageView.backgroundColor = getColor(grayColor);
    }return _iconImageView;
}

- (UILabel *)titleLab{
    if (!_titleLab) {
        _titleLab = [[UILabel alloc] init];
        _titleLab.font = DEF_FontSize_8;
        _titleLab.textColor = [UIColor blackColor];
        _titleLab.textAlignment = NSTextAlignmentCenter;
        _titleLab.text = @"合规运营";
    }return _titleLab;
}

- (void)setModel:(NSDictionary *)model{
    _model = model;
    self.iconImageView.image = [UIImage imageNamed:model[@"img"]];
    self.titleLab.text = model[@"title"];
}
@end
